/* 
 *	Copyright 2014  Yanqing Wu
 *		email: yqwu_yqwu@126.com
 *
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
*/

#pragma once
#include "StdCtrlSkin_BaseElt.h"

#include "StdCtrlSkinWnd.h"

class AFX_EXT_CLASS CStdCtrlSkin : public CStdCtrlSkin_BaseElt
{
protected:
	//	List of windows defined in config file
	std::map<CString, CStdCtrlSkinWnd*> m_wnd_list;
	//	Version of config file
	CString m_version;
	CString m_filename, m_filepath;

public:
	CStdCtrlSkin(void);
	virtual ~CStdCtrlSkin(void);

	bool LoadConfigFile(CString pathname);

	virtual bool SetWndRect(CString wndName, CRect rect);

	/*
	 *	Log a control to be managed by this tool
	 *	Parameters:
	 *		wndName:	Window name defined in the config file
	 *		ctrlName:	Control name defined in the config file (cell's name)
	 *		pCtrl:		Pointer to this control class
	 */
	virtual bool LogControl(CString wndName, CString ctrlName, CWnd* pCtrl);
	virtual bool UnlogControl(CWnd* pCtrl);

	virtual bool DoLayout(CString wndName, CRect rect);

	virtual HBITMAP GetBitmap(CString wndName, CSize size, HDC hDC);

	CString GetFilePath(void)		{ return m_filepath; }

	void SetWndBackColor(CString wndName, COLORREF color);

#ifdef __DUMPTEST
	virtual void Dump(CString pathname, CStdCtrlSkin_EnumDump type);
#endif

protected:
	//	Clean up information loaded form config file
	virtual void Reset(void);

};

